<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: pink;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            margin: 0;
            overflow-x: hidden;
        }

        .box {
            padding-top: 50px;
            margin-top: 20px;
            transition: transform 1.6s ease;
            background: firebrick;
        }

        .box.show {
            transform: translateX(0);
        }

        .container {
            width: 800px;
            display: flex;
            justify-content: space-between;
        }

        .box-left {
            width: 300px;
            height: 300px;
            transform: translateX(-500%);
        }

        .box-right {
            width: 300px;
            height: 300px;
            transform: translateX(500%);
        }

        .box-right img {
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>
    <div class="container">
        <div class="box box-left">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti doloribus blanditiis
            ullam, recusandae minima mollitia. Omnis perferendis rerum dolorem in earum, quam ratione quos officiis
            laudantium laboriosam ipsam sint soluta.</div>
        <div class="box box-right">
            <img src="./test.jpg" alt="">
        </div>
    </div>

    <script type="text/javascript">
        let oBox = document.querySelectorAll('.container');

        window.addEventListener('scroll', chBox);

        chBox();

        function chBox() {
            let triggerBottom = (window.innerHeight / 5 * 4);

            oBox.forEach(box => {
                let boxTop = box.getBoundingClientRect().top;

                if (boxTop < triggerBottom) {
                    for (const ele of box.children) {
                        ele.classList.add('show');
                    }
                } else {
                    for (const ele of box.children) {
                        ele.classList.remove('show');
                    }
                }
            })
        }
    </script>
</body>

</html>